function getWidth(){
	//if (this.webkit419) return this.innerWidth;
	//if (this.opera) return document.body.clientWidth;
	return document.documentElement.clientWidth;
}

function getHeight(){
	//if (this.webkit419) return this.innerHeight;
	//if (this.opera) return document.body.clientHeight;
	return document.documentElement.clientHeight;
}

function getScrollHeight(){
	if (this.ie) return Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight);
	//if (this.webkit) return document.body.scrollHeight;
	return document.documentElement.scrollHeight;
}

function getViewportWidth(){
    var width = self.innerWidth;  // Safari
    var mode = document.compatMode;
    
    if (mode || _jsc.client.isIE) { // IE, Gecko, Opera
        width = (mode == 'CSS1Compat') ?
                document.documentElement.clientWidth : // Standards
                document.body.clientWidth; // Quirks
    }
    return width;
}

function getViewportHeight() {
    var height = self.innerHeight; // Safari, Opera
    var mode = document.compatMode;

    if ( (mode || _jsc.client.isIE) && !_jsc.client.isOpera ) { // IE, Gecko
        height = (mode == 'CSS1Compat') ?
                document.documentElement.clientHeight : // Standards
                document.body.clientHeight; // Quirks
    }
    return height;
}

_jsc.widget = {};
_jsc.widget.lightbox = function(){
	this.show = function(o, t){
		this.render_shadow();
		var box = o;
		box.style.left = document.body.clientWidth/2-box.offsetWidth/2+'px';
		box.style.top = document.documentElement.scrollTop + getViewportHeight()/2-box.offsetHeight/2 +'px';
		box.style.visibility='visible';
		var lb = document.getElementById('lightbox');
		var as = lb.getElementsByTagName('a');
		if(as != null && as.length > 0)
		{
			as[0].focus();
			for(var i=0;i<as.length;i++){
				as[i].onfocus = "this.blur();";
			}
		}
			
	};
	
	this.render_shadow = function(){
		if($i('shadow')!='object'){
		   
		   var ShadowDiv = document.createElement('div');
		   ShadowDiv.id = 'shadow';
		   var els=document.getElementsByTagName( "select"); 
     	   for(var i=0;i <els.length;i++){ 
              els[i].style.display= "none"; 
      	   }
		   document.body.appendChild(ShadowDiv);
		   
		}
		//ShadowDiv.style.width = getWidth()+'px';
		ShadowDiv.style.width = '100%';
		ShadowDiv.style.height = getScrollHeight()+'px';
	};
	
	this.hide = function(){
		var els=document.getElementsByTagName( "select"); 
     	for(var i=0;i <els.length;i++){ 
           els[i].style.display= ""; 
      	}
		if($i('shadow')!= false ) document.body.removeChild($i('shadow'));
		document.body.removeChild($i('lightbox'));
	};
}